package com.wl.employee;

import com.wl.employee.entity.Employee;
import com.wl.employee.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Date;

@Component
@EnableScheduling
public class HrxjSchedule {
    @Autowired
    private EmployeeService employeeService;

    @Scheduled(cron="0 25 22 * * ?")
    public void executeEarlyBatch() {
        System.out.println("-----------------------");
        Employee employee = new Employee();
        employee.setEno("1111");
        employee.setBirthday(new Date());
        employee.setCreateDate(new Date());
        employee.setSex(1);
        employee.setEname("二哥");
        employee.setJoinDate(new Date());
        employeeService.addEmployee(employee);
    }
}
